<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/messages.jsp"%>
<%@ include file="/commons/commonEdit.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${key.charge_paybill_title}</title>
<script language="javaScript" type="text/javascript" src="${ctx}/pages/com/ce/pms/charge/cashiering/payMode.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script>
var divListObj = null;
var noRecord="";
function showResult(){
         if(noRecord=='yes'){
         return false;
         }
		var isTrue=$('payBillForm').fireEvent("onSubmit");
	    if(isTrue){
	        var url = "${ctx}/charge_cashieringAction.do?method=addPayBill&accountHouseId=${accountHouseId}";
	        $('payMode').value= divListObj.getResult();
	        var param = Form.serialize('payBillForm');
	        new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResponse});
		}
	}
function showResponse(response){
	if(response.responseText == "true" ){
	    var obj = findFrame("connTabPanel");
	    obj.refresh();
	    var url = "${ctx}/charge_cashieringAction.do?method=clearCache";
	    new Ajax.Request(url,{method: 'post',onSuccess : function(){
	    $('payDetailFrame').src="${ctx}/charge_cashieringAction.do?method=payBillDetailList&accountId=${accountId}";
	    var len = $("layer1").rows.length;
	    for(var i = 0; i < len;i++)
	    	$("layer1").deleteRow();
	    divListObj = new sectionChargeObj("layer1","${payModeStr}");
	    divListObj.initTbody();
	    }});
    }
    else
       ajaxSubmitException(response.responseText);
}
function myclose(){
	 var url = "${ctx}/charge_cashieringAction.do?method=clearCache";
	 new Ajax.Request(url,{method: 'post',onSuccess : function(){parent.myClose();}});
}
function setCurrencyTotal(money){
	$('currencyTotal').innerHTML = money;
	if(money<=0)
		$('layer1').getElementsByTagName('INPUT')[0].value = "0";
	else
	    $('layer1').getElementsByTagName('INPUT')[0].value=money;
}
function closeExceptionPage(){
myclose();
}

function setNoRecord(noRecorded){
noRecord=noRecorded;
}
</script>
</head>
<body onload="init();">
<div id="cc" style="height:480px;overflow:auto;" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="middle" class="content">
    <form name="payBillForm" method="post" action="" class="required-validate">
    <input type="hidden" name="payMode">
    <input type="hidden" name="isVirtual" value="${isVirtual}">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="aux_outtable_color" colspan="4">
		    <iframe src="" name="payDetailFrame" id="payDetailFrame" width="100%"  height="200px"  frameborder="0" border="0"  scroll="yes" ></iframe>
  			</td>
          </tr>
          <tr>
          	<td colspan="4">
				<table width="100%" border="0" cellspacing="0" cellpadding="0"  class='gridData2'>
                 <tr  class="grid2">
                   <td colspan="7" class="chareg_hj">共合：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                   <td align="right" class="chareg_hj"><span class="font_red" id="currencyTotal"><fmt:formatNumber pattern="###,##0.0000" value="${totalCurrency}"/></span>&nbsp;${key.yuan}&nbsp;</td>
                 </tr>
                </table>
              </td>
          </tr>
          <tbody id="layer1">
		  </tbody>
            <tr>
              <td colspan="4" valign="top" class="aux_titletable">${key.charge_paybill_remark}</td>
            </tr>
          <tr>
            <td valign="top" class="aux_intable_td1">${key.charge_paybill_remark}：</td>
            <td colspan="3" class="aux_intable_td2"><textarea name="remark" cols="50" rows="3"></textarea></td>
           </tr>
      </table>
	</form>
    </td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_61"></td>
              <td class="buttonOffMiddle" id="btn1_62" onClick="showResult();" onMouseOver="btn_change_over(6)" onMouseOut="btn_change_out(6)" onBlur="btn_change(6)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.save}</td>
              <td class="buttonOffRight" id="btn1_63"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_91"></td>
              <td class="buttonOffMiddle" id="btn1_92" onClick="myclose();" onMouseOver="btn_change_over(9)" onMouseOut="btn_change_out(9)" onBlur="btn_change(9)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom"> ${key.close}</td>
              <td class="buttonOffRight" id="btn1_93"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script defer>
function init(){
	divListObj = new sectionChargeObj("layer1","${payModeStr}");
	divListObj.initTbody();
	$('payDetailFrame').src="${ctx}/charge_cashieringAction.do?method=payBillDetailList&accountId=${accountId}";
}
</script>
</div>
</body>
</html>